package model

import (
	"go-caipu/pkg/services/dto"
)

type SysRole struct {
	RoleId    int64     `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码
	RoleName  string    `json:"roleName" gorm:"size:128;"`              // 角色名称
	Status    int       `json:"status" gorm:"size:4;"`                  //
	RoleKey   string    `json:"roleKey" gorm:"size:128;"`               //角色代码
	Sort      int       `json:"sort" gorm:""`                           //角色排序
	Flag      string    `json:"flag" gorm:"size:128;"`                  //
	Remark    string    `json:"remark" gorm:"size:255;"`                //备注
	Admin     bool      `json:"admin" gorm:"size:4;"`
	DataScope string    `json:"dataScope" gorm:"size:128;"`
	Params    string    `json:"params" gorm:"-"`
	MenuIds   []string  `json:"menuIds" gorm:"-"`
	DeptIds   []string  `json:"deptIds" gorm:"-"`
	SysMenu   []SysMenu `json:"sysMenu" gorm:"many2many:sys_role_menu;foreignKey:RoleId;joinForeignKey:role_id;references:MenuId;joinReferences:menu_id;"`
	SysDept   []SysDept `json:"sysDept" gorm:"many2many:sys_role_dept;foreignKey:RoleId;joinForeignKey:role_id;references:dept_id;joinReferences:dept_id;"`
	dto.ControlBy
	dto.ModelTime
}

func (SysRole) TableName() string {
	return "sys_role"
}
